package com.hadluo.qq.server.controller;

import com.hadluo.qq.server.websocket.ChatWebSocket;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/user")
public class UserStatusController {

    @GetMapping("/status/{userId}")
    public Map<String, Object> getUserStatus(@PathVariable String userId) {
        Map<String, Object> response = new HashMap<>();
        boolean isOnline = ChatWebSocket.isUserOnline(userId);
        response.put("online", isOnline);
        return response;
    }
}